function getCookie(name) {
	var cookie = decodeURIComponent(document.cookie);
	var cookieStr = cookie.replace(/ /g, "");
	var arr = cookieStr.split(";");
	for (var i = 0; i < arr.length; i++) {
		var str = arr[i];
		var arr2 = str.split("=");
		if (arr2.length >= 2) {
			if (arr2[0] == name) {
				return arr2[1];
			}
		}
	}
	return null;
}

function setCookie(name, value, expires, path, domain, secure) {
	var cookieText = encodeURIComponent(name) + "=" + encodeURIComponent(value);
	if (expires instanceof Date) {
		cookieText += ";expires=" + expires;
	}
	if (path) {
		cookieText += ";path=" + path;
	}
	if (domain) {
		cookieText += ";domain=" + domain;
	}
	if (secure) {
		cookieText += ";" + secure;
	}
	document.cookie = cookieText;
	return decodeURIComponent(cookieText);
}

function removeCookie(name) {
	document.cookie = encodeURIComponent(name) + "= ; expires=" + new Date();
}
